@echo off
chcp 65001 >nul
echo ====================================
echo  PostgreSQL 路径查找工具
echo ====================================
echo.

echo [1] 检查常见安装路径...
echo.

if exist "C:\Program Files\PostgreSQL\" (
    echo ✓ 找到: C:\Program Files\PostgreSQL\
    dir "C:\Program Files\PostgreSQL\" /b
    echo.
) else (
    echo ✗ 未找到: C:\Program Files\PostgreSQL\
)

if exist "C:\Program Files (x86)\PostgreSQL\" (
    echo ✓ 找到: C:\Program Files (x86)\PostgreSQL\
    dir "C:\Program Files (x86)\PostgreSQL\" /b
    echo.
) else (
    echo ✗ 未找到: C:\Program Files (x86)\PostgreSQL\
)

echo [2] 查找所有 psql.exe 文件...
echo 这可能需要几分钟，请稍候...
echo.
dir /s /b "C:\psql.exe" 2>nul
dir /s /b "C:\Program Files\*psql.exe" 2>nul
dir /s /b "C:\Program Files (x86)\*psql.exe" 2>nul

echo.
echo [3] 检查 PostgreSQL 服务...
sc query | findstr /i "postgresql"

echo.
echo ====================================
echo.
echo 请将找到的 psql.exe 完整路径记录下来
echo 例如: C:\PostgreSQL\15\bin\psql.exe
echo.
pause

